<?php

include("admin_lock.php");


if(!isset($_POST['semester']) || !isset $_POST['subject'] || !isset $_POST['courseNumber'] || !isset $_POST['courseName'] || !isset $_POST['sectionNumber'] || !isset $_POST['description'] || !isset $_POST['instructor'] || !isset $_POST['time'] || !isset $_POST['days'] || !isset $_POST['building'] || !isset $_POST['room'])
{
	header("Location: editClass.php?error=1");
	die();
}

require("config.php");

$semester=$_POST['semester'];
$subject=$_POST['subject'];
$courseNum=$_POST['courseNumber'];
$courseName=$_POST['courseName'];
$sectionNum=$_POST['sectionNumber'];
$description=$_POST['description'];
$instructor=$_POST['instructor'];
$time=$_POST['time'];
$days=$_POST['days'];
$building=$_POST['building'];
$room=$_POST['room'];

$updateCourseQuery="Update Course set semester=$semester,subject=$subject,number=$courseNum,name=$courseName,description=$description,sectionNum=$sectionNum";
$updateSectionQuery="Update Section set instructor=$instruction,time=$time,day=$day,room=$room,building=$building";

$courseResult=mysql_query(addslashes($updateCourseQuery));
$sectionResult=mysql_query(addslashes($updateSectionQuery));

if(!$courseResult || !$sectionResult)
{
	header("Location: editClass.php?");
}
else
{
	header("Location: admin.php");
}

?>
